<template>
<div class="header">
    首页
    <el-button type="primary" @click="exitt">退出登录</el-button>
</div>



<div class="body"> 
    <div class="side-bar">
        <h4>菜单</h4>

        <el-menu default-active="" open close unique-opened>
            <RecursiveMenu :menuData="listdata" />
        </el-menu>
        <!-- <el-menu
        default-active=""
        open
        close
        unique-opened
        >
            <el-sub-menu index="1">
                    <template #title>
                        <span>财务报销</span>
                    </template>
                        <el-menu-item index="1-1"  @click="router.push('/res')" >费用付款</el-menu-item>
            </el-sub-menu>

            <el-sub-menu index="2">
                    <template #title>
                        <span>员工部门</span>
                    </template>
                        <el-menu-item index="2-1"  @click="router.push('/emp')" >员工列表</el-menu-item>
                        <el-menu-item index="2-2"  @click="router.push('/cu')" >增加员工</el-menu-item>
            </el-sub-menu>

            <el-sub-menu index="3">
                    <template #title>
                        <span>资源配置</span>
                    </template>
                        <el-menu-item index="3-1"  @click="router.push('/source')" >增加资源</el-menu-item>
                        <el-menu-item index="3-2"  @click="router.push('/role')" >角色资源</el-menu-item>
            </el-sub-menu>



        </el-menu> -->
    </div>


    <div class="main">
        <router-view></router-view>
    </div>

</div>



</template>





<script setup>
import { ref,onMounted } from 'vue'
import axios from 'axios';
import { useRouter } from 'vue-router'
import router from '../router';
import http from '../http';
import RecursiveMenu from '../components/RecursiveMenu.vue';



const listdata = JSON.parse(localStorage.getItem('list'));
const token = localStorage.getItem('token');






const getsourcelist = () =>{
    axios.get('http://127.0.0.1:8000/rbac/slist/')
    .then((res)=>{
        console.log(res);
        listdata.value = res.data.resource_list;
    })

}

// onMounted(()=>{
//     router.push({
//         path:'/',
//     })
// })


const ppush = (url) =>{
    router.push({
        path:url,
    })
}




const exitt = () =>{
    http.post('http://127.0.0.1:8000/rbac/loginout/',{
        token:token,
    }).then((res)=>{
        console.log(res);
    })
}



</script>




<style scoped>

.header{
    height: 100px;
    background-color: pink;
}

.body{
    display: flex;

}

.side-bar{
    width: 200px;

}





</style>